package cn.vawn.base.task;

import cn.vawn.base.service.ISmsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Add by jianhan on 2018/5/19
 */
@Component
public class SmsTask {
    private static Logger logger = LoggerFactory.getLogger(SmsTask.class);

    @Autowired
    ISmsService smsService;

    /**
     * 每天凌晨1，2点清理昨天之前的验证码请求，黑白名单记录
     */
    @Scheduled(cron="0 0 1,2 * * ?")
    public void cleanBeforeYesterdayRecord() {
        logger.info("try execute task cleanBeforeYesterdayRecord");
        smsService.cleanBeforeYesterdayRecord();
    }
}
